package com.richest.api.controller;

import com.richest.api.utils.RedisUtils;
import com.richest.util.CallResults;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wesley on 2017-03-23. ExamplesController
 */
@Api(value = "工程状态接口")
@RestController
@RequestMapping("/statusController")
@EnableAutoConfiguration
public class statusController {

	private Logger log = LoggerFactory.getLogger(statusController.class);

	@Autowired
	private RedisUtils redisUtil;

	/**
	 * 工程状态
	 * 
	 * @param examples
	 * @return
	 */
	@RequestMapping("/status")
	@ApiOperation(notes = "测试接口状态", value = "测试接口状态", httpMethod = "GET")
	@ApiImplicitParam(name = "status", value = "状态参数", required = true, paramType = "query", dataType = "String")
	public CallResults add(@RequestParam String status) {
		log.info("测试工程状态");
		redisUtil.set("status", status);
		return CallResults.ok().put("data", redisUtil.get("status"));
	}
}
